<!DOCTYPE html>
<html>

	<head>
		<title>五域联盟</title>
		<meta charset="utf-8">
		<meta name="Description" content="" />
		<meta name="Keywords" content="" />
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
		<meta name="applicable-device" content="mobile" />
		<meta name="apple-mobile-web-app-title" content="" />
		<!-- 添加到主屏后的标题（iOS 6 新增） -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!-- 是否启用 WebApp 全屏模式 -->
		<meta name="HandheldFriendly" content="true" />
		<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
		<meta name="author" content="Jack" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!--<script type="text/javascript" src="../js/flexible.js"></script>-->
		<link rel="stylesheet" type="text/css" href="__STATIC__/module/index/css/min.css"/>
		<link rel="stylesheet" type="text/css" href="__STATIC__/module/index/css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/module/index/css/jquery-weui.min.css" />
	</head>

	<body>
		<div class="rest-box">
			<div class="register-box">
				<div class="max-size" style="margin:1.8rem 0">欢迎加入五域联盟</div>
				<div class="input-outer">
					<input type="tel" class="input-style" placeholder="请输入手机号" id="reg-phone"/>
				</div>
				<div class="input-outer">
					<input type="number" class="input-style code-input" placeholder="请输入验证码" id="reg-code"/>
					<input type="button" class="get-code-btn"  onclick="get_code()" value="获取验证码" />
				</div>
				<div class="input-outer">
					<input type="password" class="input-style" placeholder="请输入密码" id="find-pwd1"/>
				</div>
				<div class="input-outer">
					<input type="password" class="input-style" placeholder="请再次输入密码" id="find-pwd2"/>
				</div>
				<div class="input-outer">
					<input type="text" class="input-style" placeholder="请输入姓名" id="input-name"/>
				</div>
				<div class="input-outer">
					<input type="text" class="input-style" placeholder="邀请码" value="分享人：{$info.name}" id="recommend" readonly="readonly"/>
				</div>
				<!--<div for="weuiAgree" class="user-agree">-->
					<!--<label class="weui-agree__text" id="isdest">-->
						<!--<input id="weuiAgree" type="checkbox" class="weui-agree__checkbox" checked>-->
						<!--阅读并同意-->
					<!--</label>-->
					<!--<a href="http://app.lptxhr.com/index.php/index/details/id/43">《用户协议和隐私政策》</a>-->
				<!--</div>-->
			</div>
			
		</div>
		
		<a href="#" class="pub-button " onclick="register()">完成</a>
		<div class="return-login" style="text-align: center;font-size: 16px;margin-top: 0.5rem;margin-bottom:0.5rem">
		<a href="http://www.chinawylm.com" class="">下载APP</a>
		</div>
		
	</body>
	<script src="__STATIC__/module/index/js/jquery-3.1.0.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="__STATIC__/module/index/js/fastclick.js" type="text/javascript" charset="utf-8"></script>
	<script>
		$(function() {
			FastClick.attach(document.body);
		});
	</script>
	<script src="__STATIC__/module/index/js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
	<!--<script src="__STATIC__/module/index/js/pub_url.js" type="text/javascript" charset="utf-8"></script>-->
	<script type="text/javascript" src="__STATIC__/module/index/js/md5/md5.js"></script>
	<script type="text/javascript" src="__STATIC__/module/index/js/md5/access.js" ></script>
	<script type="text/javascript">
		function register(){
			var username=$.trim($('#reg-phone').val());
			var code=$('#reg-code').val();
			var uid='{$info.id}';
			var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
			if($.trim($('#reg-phone').val()) == ''){
				$.toast("请输入手机号！","text");
				return false;
			}						
            if(!reg.test(username)) {
            	$.toast("请正确填写手机号！","text");
                 return false;
            }           
            if($.trim(code) == ''){
				$.toast("请输入验证码！","text");
				return false;
			}
			if($.trim($('#reg-code').val()) == ''){
				$.toast("请输入验证码!", "text");
				return false;
			}
			if($.trim($('#find-pwd1').val()) == ''){
				$.toast("请填写密码!", "text");
				return false;
			}
			if($.trim($('#find-pwd1').val()).length<6){
				$.toast("密码不能小于6位数!", "text");
				return false;
			}
			if($.trim($('#find-pwd2').val()) == ''){
				$.toast("请再次输入密码!", "text");
				return false;
			}
			if($.trim($('#find-pwd2').val()).length<6){
				$.toast("密码不能小于6位数!", "text");
				return false;
			}
			if($.trim($('#find-pwd1').val())!== $.trim($('#find-pwd2').val())){
				$.toast("两次密码输入不一致!", "text");
				return false;
			}
			if($.trim($('#input-name').val()) == ''){
				$.toast("请填写姓名!", "text");
				return false;
			}
			var data={
				username:username,
				name:$('#input-name').val(),
				code:code,
				password:$('#find-pwd1').val(),
				tjid:uid
			};
			$.post("{:url('share/registers')}",data,function(datas){
				if(datas.error == 0){
					$.toast(datas.msg,"text");
					location.href="http://www.chinawylm.com/index/";
				}else{
					$.toast(datas.msg,"text");
				}
			},'json');
		}
		function get_code(){
			var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
			if($.trim($('#reg-phone').val()) == ''){
				$.toast("请输入手机号！","text");
				return false;
			}						
            if(!reg.test($.trim($('#reg-phone').val()))) {
            	$.toast("请正确填写手机号！","text");
                return false;
            }
           $.ajax({
				url: '{:url("send")}', //请求的url地址
				dataType: "json", //返回格式为json
				data:{
					phone:$('#reg-phone').val(),
				},
				type: "POST", //请求方式
				success: function(res) {
					if(res.code==0){
						$.toast('验证码已发送！',"text");
						$(".get-code-btn").addClass("on");
						  var time = 60;
						  $(".get-code-btn").attr("disabled", true);
						  var timer = setInterval(function() {
						   if (time == 0) {
							    clearInterval(timer);
							    $(".get-code-btn").attr("disabled", false);
							    $(".get-code-btn").val("获取验证码");
							    $(".get-code-btn").removeClass("on");
						   } else {
							    $('.get-code-btn').val(time + "s重新获取");
							    time--;
						   }
						  }, 1000);
					}else{
						$.toast(res.msg,"text");
					}
				},
				error: function(rul) {
					console.log('网络出错')
				}
			});
		}
	</script>
</html>